package com.xx.cloud.pay.controller

import com.xx.cloud.pay.entity.FairLoginLog
import com.xx.cloud.pay.result.R
import com.xx.cloud.pay.service.LogService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.{GetMapping, RequestMapping, RequestParam, RestController}


/**
 * 整合Scala语言
 * 可以和java混合开发
 */
@RestController
@RequestMapping(Array("/pay"))
class LogController {


  @Autowired
  private val payService: LogService = null


  /**
   * 查询列表
   * @param file
   * @return
   */
  @GetMapping(Array("list"))
  def list(): R[_] = {
    val scalaList: java.util.List[FairLoginLog] = payService.list()
    println(scalaList)
    R.ok(scalaList, "ok")
  }

  /**
   * 查询详情
   * @param file
   * @return
   */
  @GetMapping(Array("info"))
  def info(@RequestParam("id") id: String): R[_] = {
    val fairLoginLog: FairLoginLog = payService.getById(id)
    R.ok(fairLoginLog, "查询成功")
  }

}
